import requests
from APIs.baseAPI import BaseAPI
from common.config import ip


class LoginAPI(BaseAPI):
    def login(self,username,password):
        mydata = {"username": username, "password": password}
        r = requests.post(f"{ip}/login", data=mydata)
        return r.json()

    def getToken(self):
        mydata = {"username": "admin", "password": "123456"}
        r = requests.post(f"{ip}/login", data=mydata)
        return r.json()["Admin-Token"]
if __name__ == '__main__':
    l=LoginAPI()
    s=l.login("admin","123456")
    print(s)
